package com.splic.common.config;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

import static com.alipay.api.AlipayConstants.CHARSET_UTF8;
import static com.alipay.api.AlipayConstants.FORMAT_JSON;
import static com.alipay.api.AlipayConstants.SIGN_TYPE_RSA2;

/**
 * ==========================
 * 开发：singe
 * 创建时间：2022-03-10 22:51
 * 版本: 1.0
 * 描述：TODO
 * ==========================
 */
@Component
@ConfigurationProperties(prefix = "alipay")
public class AliPayConfig {

    public static String SERVICE_URL = "https://openapi.alipay.com/gateway.do";
    public static String APPID = "2021003121628615";
    public static String PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCBnX5H2B+iVb7jaFzFrh+AXNAGMHBmW2RNDeBeWIT/wUFdqxFMEy6SSbzZcdQNx26cLkgAgjsBxjT4+CMnmeYtiGvBEOJoUbmffwYhQN4d3Lndso4tIYpiEos2ktQQMhjhbLZVhs9UpEqqjPzh3jmW6v9XB6THLmQecaewtIIpCaX2SKdgbBN5oX6vfRatznH4qw4DiThmmSvVevynNDDakxR8uBYD4pRAugPeTkqJhCekAVoXams9Vqg9NiMjereQEj3zja4VwYxXWFdVi1Ytpnw0/qKuvdqNbqe2VqeuogSxu4Zpb42g14pNGpnaaFIhnezk5fTWPC705rOw3fAzAgMBAAECggEAYCFMrUAvhhiOMN8QH1Ta7Drp1g1K779MjpGCHLcOPRk5v5zGgWOgoMKrm6H+ohGNiawRnr73wIMeeqCeghp0SsTpFhHNuY0TXKW7CCKyGffAqhpptDMyDTavpVQUj8Z4CYi1Wo1Xa/FFp2RVkbddgv7bTdLPdSKFAsdMlZPrDT+WrQ0cLSPiPHPsjBYXobUnhY+HlFeRsxNGaIzRENy7K6Pji/up2JxusTlxkg3f3EWLQoO+gFyra5MoEtBg8Tfi5mLnf6lb5K1um/yBjsNSNYADbOQybSkmj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V3ljcQ/hHPAB2vmaiCd+PR80bfQyih2Vgl5dbmMBjDpSeq75M9EAlrCtU50sAKEyS/JHxcrZA1C3qwiuA8Tu3b8h+6xBBK6g7EevnydGKkdnRISriFFzWspBkeA38XbjXFFd/R+JqcToM2mKVobcnH/e+PtEGIad0tA6zQ6Bzfccg/dWfHHY1eQDVN2j7ya+AOArQYKu4usDPd13o6swa08EQXeRQD4QJ9SGIoROzS73OVpSvPL/q1KprcWsZ6/+ZQIDAQAB";
    public static String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsWQBcDPaxKTvCuoJO/YoUngDXfdj4/D3W0LHXbuEj5yHAQWuH8OytnAfwRXUd/iGM7dtCElroPyDb/YMhSQBXx/COdNQU1k5v02QOj09efWD4oNASZn3WqcsoQYWAajEC38O/ulLYsURJyTkciyFhqX5V06ATgkzZenD7w4zKFFDPREMhdo9vtt1eOKBKD5rMADoGOGej2eMPP441pbgn450uUQGttjIWn77luUtVDyufz7t7jUfNMqQoH/vgIULoQQqfr7Xp+FITOrHA0cHXTN0Ed+2uLGkE5JppmEgmnJUgXrdvaMcwmHmbbglKpH1hrMDqTALtIvCney5zQVv5wIDAQAB";
    public static String NOTIFY_URL = "https://api.ej-mobile.cn/api/payNotify/aliPayNotify";
    public static String alipaySystemOauth = "alipay_system_oauth_token_response";
    public static String PID = "2088111040466267";


    public static AlipayClient alipayClient;

    /**
     * 创建单例
     * @return
     */
    @PostConstruct
    public AlipayClient alipayClientHolder(){
        alipayClient = new DefaultAlipayClient(SERVICE_URL,APPID,PRIVATE_KEY,FORMAT_JSON, CHARSET_UTF8,ALIPAY_PUBLIC_KEY, SIGN_TYPE_RSA2);
        return alipayClient;
    }

}
